package RJZ.Rainbow.UserServer.entity;

import RJZ.Rainbow.UserServer.entity.FileEntity.FilePacket;

import java.io.File;
import java.io.RandomAccessFile;

public class FileBlock {
    public FilePacket filePacket=new FilePacket();
    public int byteRead;
    public volatile Long start = 0l;
    public volatile int lastLength = 0;
    public RandomAccessFile randomAccessFile;
    public void set(String imagepath)
    {
        File file = new File(imagepath);
        String fileMd5 = file.getName();
        this.filePacket.setFile(file);
        this.filePacket.setFile_md5(fileMd5);
        this.filePacket.setStartPos(0);
    }
    public void flush(){
        filePacket=null;
        byteRead=0;
        start = 0l;
        lastLength = 0;
        randomAccessFile=null;
        filePacket=new FilePacket();
    }
}
